package top.sssd.spi.pf4j.impl;

import org.pf4j.Extension;
import org.pf4j.RuntimeMode;
import top.sssd.spi.pf4j.api.GreetingPlugin;
import top.sssd.spi.pf4j.api.GreetingService;
import top.sssd.spi.pf4j.api.PluginContext;

public class ChinesePlugin extends GreetingPlugin {

    public ChinesePlugin(PluginContext context) {
        super(context);
    }

    @Extension
    public static class ChineseGreetingServiceImpl implements GreetingService {
        public void sayHello(String name) {
            System.out.println("你好 " + name);
        }
    }

    @Override
    public void start() {
        System.out.println("ChinesePlugin start");
        if (RuntimeMode.DEVELOPMENT.equals(context.getRuntimeMode())) {
            System.out.println("ChinesePlugin");
        }
    }

    @Override
    public void stop() {
        System.out.println("ChinesePlugin stop");
    }

    @Override
    public void delete() {
        System.out.println("ChinesePlugin delete");
    }
}
